package collection;

import java.lang.reflect.Array;
import java.util.*;

public class Homework {
    public static void main(String[] args) {
        Collection coll = new ArrayList();
        coll.add(new Point(1, 2));
        coll.add(new Point(3, 4));
        coll.add(new Point(5, 6));
        coll.add(new Point(7, 8));
        coll.add(new Point(9, 0));
        coll.add(new Point(1, 2));
        System.out.println(coll);
        Point p = new Point(1, 2);
        boolean b = coll.contains(p);
        System.out.println(b);
        coll.remove(p);
        System.out.println(coll);
        Collection cc = new ArrayList();
        Point pp = new Point(1, 2);
        cc.add(pp);
        System.out.println(pp);
        System.out.println(cc);
        pp.setX(100);
        System.out.println(pp);
        System.out.println(cc);

        System.out.println(cc.isEmpty());
        coll.clear();
        System.out.println(coll);
        System.out.println(coll.isEmpty());
        coll.addAll(cc);
        System.out.println(coll);
        Iterator it = coll.iterator();
        while (it.hasNext()) {
            Point str = (Point) it.next();
            System.out.println(str);
        }
        String[] str = {"mjh", "123", "plmm"};
        for (String ing : str) {
            String ooo = (String) ing;
            System.out.println(ooo);
        }
        Collection<String> fanxing = new ArrayList<>();
        fanxing.add("mjh");
        fanxing.add("qqq");
        fanxing.add("www");
        fanxing.add("eee");
        fanxing.add("rrr");
        for (int i = 0; i < fanxing.size(); i++) {
            System.out.println(fanxing);
        }
        Iterator<String> iter = fanxing.iterator();
        while (iter.hasNext()) {
            String bb = iter.next();
            System.out.println(bb);
        }
        for (String we : fanxing) {
            System.out.println(we);
        }
        System.out.println(fanxing);
        fanxing.toArray();
        System.out.println(fanxing);
        Collection<String> co = new ArrayList<>();
        co.add("123");
        co.add("234");
        co.add("345");
        co.add("456");

        String [] array=co.toArray(new String[5]);
        System.out.println(Arrays.toString(array));

    }
}
